﻿using System;
using System.Collections.Generic;
using GetTogether.Studio.Logging;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class logging_LoggingList : GetTogether.Studio.Web.UI.Page
{
    public ProjectParameter Parameter;
    public string ProjectName
    {
        get
        {
            return Request["pn"];
        }
    }
    public string LogPath
    {
        get
        {
            return Request["path"];
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Parameter = ProjectParameter.GetSettingsByProjectName(CurrentSession.UserCode, ProjectName, CurrentSession.ShareUserCode);
        if (Parameter != null)
        {
            GetTogether.Studio.ProjectHistory.SaveHistory(GetTogether.Studio.ProjectParameter.ProjectCategory.Logging, ProjectName, CurrentSession.UserCode);
        }
        else
        {
            if (!string.IsNullOrEmpty(ProjectName) && !string.IsNullOrEmpty(LogPath))
            {
                Parameter = new ProjectParameter();
                Parameter.Url = LogPath;
                Parameter.ProjectName = ProjectName;
                GetTogether.Utility.FileHelper.SerializeToFile(Parameter, System.IO.Path.Combine(GetTogether.Studio.Logging.ProjectParameter.GetSettingsPath(CurrentSession.UserCode), Parameter.ProjectName));
            }
        }
    }

    protected string GetShareInfo()
    {
        string url = Request.Url.ToString();
        if (url.ToLower().IndexOf("share-usercode") < 0)
        {
            url = string.Concat(url, "&share-usercode=", CurrentSession.UserCode);
        }
        return url;
    }
}